<?php
/**
 * RCenter首页控制器
 * 管理登录页、注册页、管理框页
 * @author Pony
 */
class main extends spController{
	function index(){
		if(empty($_SESSION['ucid'])){
			$this->jump(spUrl('main','login'));
		}
		elseif($_SESSION['ucid'] == RC_ADMIN){
			$this -> jump(spUrl('main','frame'));
		}
	}
	
	function login(){
		$this->tpl_img = TPL_IMG;
		$this->cookie_ucname = $this->spArgs('ucname');
		$this->display('login.html');
	}
	
	function register(){
		if(spAccess('r','ALLOW_GUEST_REGISTER') != '1')$this->error('系统目前不允许用户注册',spUrl('main','login'));
		$this->tpl_img = TPL_IMG;
		$this->display('register.html');
	}
	
	function frame(){
		if($_SESSION['ucid'] != RC_ADMIN){$this->error('您不是RCenter管理员',spUrl('main','login'));}
		$this->tpl_img = TPL_IMG;
		$this->display('admin_frame_index.htm');
	}
	
	function frame_menu(){
		if($_SESSION['ucid'] != RC_ADMIN){$this->error('您不是RCenter管理员',spUrl('main','login'));}
		$this->tpl_img = TPL_IMG;
		$this->display('admin_frame_menu.htm');
	}
	
	function frame_main(){
		if($_SESSION['ucid'] != RC_ADMIN){$this->error('您不是RCenter管理员',spUrl('main','login'));}
		$this->tpl_img = TPL_IMG;
		$this->rc_version = RC_VERSION;
		$this->sp_version = SP_VERSION;
		$this->server_software = $_SERVER[SERVER_SOFTWARE];
		$this->server_name = $_SERVER[SERVER_NAME];
		$this->rc_admin = spClass('spUcenter') -> uc_get_user(RC_ADMIN,1);
		$this->group_count = spDB('rc_groups') -> findCount();
		$this->member_count = spDB('rc_members') -> findCount();
		$this->right_count = spDB('rc_rights') -> findCount();
		$this->display('admin_frame_main.htm');
	}
	
	function frame_header(){
		if($_SESSION['ucid'] != RC_ADMIN){$this->error('您不是RCenter管理员',spUrl('main','login'));}
		$this->tpl_img = TPL_IMG;
		$this->display('admin_frame_header.htm');
	}
}